package com.example.roleplay.service;

import java.util.List;

/**
 * 网络搜索服务接口
 * 基于阿里云DashScope MCP WebSearch服务
 */
public interface WebSearchService {
    
    /**
     * 执行网络搜索
     *
     * @param query 搜索查询
     * @param maxResults 最大结果数量
     * @return 搜索结果列表
     */
    List<SearchResult> search(String query, int maxResults);
    
    /**
     * 判断是否需要进行网络搜索
     *
     * @param query 用户查询
     * @return 是否需要搜索
     */
    boolean shouldSearch(String query);
    
    /**
     * 搜索结果数据类
     */
    class SearchResult {
        private String title;
        private String content;
        private String url;
        private String source;
        
        public SearchResult() {}
        
        public SearchResult(String title, String content, String url, String source) {
            this.title = title;
            this.content = content;
            this.url = url;
            this.source = source;
        }
        
        // Getters and Setters
        public String getTitle() {
            return title;
        }
        
        public void setTitle(String title) {
            this.title = title;
        }
        
        public String getContent() {
            return content;
        }
        
        public void setContent(String content) {
            this.content = content;
        }
        
        public String getUrl() {
            return url;
        }
        
        public void setUrl(String url) {
            this.url = url;
        }
        
        public String getSource() {
            return source;
        }
        
        public void setSource(String source) {
            this.source = source;
        }
        
        @Override
        public String toString() {
            return "SearchResult{" +
                    "title='" + title + '\'' +
                    ", content='" + content + '\'' +
                    ", url='" + url + '\'' +
                    ", source='" + source + '\'' +
                    '}';
        }
    }
}